/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package graph;

/**
 *
 * @author Gonzalo
 */
public class NodesU extends Nodes{
    long actual;
    long size;


    public NodesU(long s){
        size=s;
    }

    @Override
    public boolean isUniverse(){
        return true;
    }

    @Override
    public boolean contains(long n){
        if(n<=size)
            return true;
        return false;
    }
    @Override
    public Nodes interseccion(Nodes X){
        return X;
    }
    @Override
    public Nodes union(Nodes X){
        return this;
    }
    @Override
    public Nodes diferencia(Nodes X){
        Nodes out=new Nodes();
        for(init();notNull();next()){
            if(!X.contains(actual))
                out.add(actual);
        }
        return out;
    }
    @Override
    public Nodes complemento(){
        return new Nodes();
    }
    @Override
    public long count(){
        return size;
    }

    @Override
    public void init(){
        actual=1;
    }
    @Override
    public boolean notNull(){
        return actual<=size; 
    }
    @Override
    public void next(){
        actual++;
    }
    @Override
    public long getActual(){
        return actual;
    }
}
